Request for feature: pg_dump schema masquerade flag - Mailing list pgsql-general

From Owen Hartnett
Subject Request for feature: pg_dump schema masquerade flag
Date
Msg-id p06230905c322b0b1ce56@[192.168.0.109]
Whole thread Raw
In response to Re: question about pg_dump -a  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-general
I don't think this would be too hard to effect:

When pg_dumping a schema, have an additional flag -m <newschemaname>,
that would convert all references in the dump from the original
schema to the new schema name.

Thus the command:

pg_dump -c -s myoldschemaname -m mynewschemaname mydatabase -f foo

would generate a dump file such that all the data that was in
myoldschemaname would, upon psql mydatabase < foo would be in a new
(or replaced) schema mynewschemaname.

The present strategy is to go through the dump and manually change
the schema names in the dump text.  This is not a reliable mechanism,
as there may be name collisions with the schema name and other names,
and there's always the possibility that you might miss one when
you're hand modifying the code.

I'd be happy to help on the effort if that makes sense.  I don't know
what the code to pg_dump is like, though.

-Owen

pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: question about pg_dump -a
Next
From: Henrik
Date:
Subject: Preventing selection of data during transaction